package org.example.im.client.handler;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import org.example.im.bean.protocol.response.LogoutResponsePacket;
import org.example.im.common.util.SessionUtil;
import org.springframework.stereotype.Component;

/**
 * @author dingrui
 * @since 2022/2/12
 * @description 登出
 */
@Component
public class LogoutHandler extends SimpleChannelInboundHandler<LogoutResponsePacket> {

    @Override
    protected void channelRead0(ChannelHandlerContext channelHandlerContext, LogoutResponsePacket logoutResponsePacket) throws Exception {
        SessionUtil.unBindSession(channelHandlerContext.channel());
    }
}
